tests: Use strict mode by default for C tests
authorColin Walters <walters@verbum.org>
Mon, 6 Jun 2016 19:00:13 +0000 (15:00 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 6 Jun 2016 20:24:21 +0000 (20:24 +0000)
I was extending the C-based test suite to cover more, and noticed that
we weren't aborting if a command failed.  That made the tests somewhat
less useful, so let's fix it.

Closes: #321
Approved by: jlebon

tests/libostreetest.c

index 58283368ae1212019543ee82de66a79a8007bae4..a557ee371640d7703e979c8f9f8f57f41859ecf7 100644 (file)
@@ -40,7 +40,7 @@ run_libtest (const char *cmd, GError **error)
   g_ptr_array_add (argv, "bash");
   g_ptr_array_add (argv, "-c");
 
-  g_string_append (cmdstr, ". ");
+  g_string_append (cmdstr, "set -xeuo pipefail; . ");
   g_string_append (cmdstr, builddir);
   g_string_append (cmdstr, "/tests/libtest.sh; ");
   g_string_append (cmdstr, cmd);
@@ -68,7 +68,7 @@ ot_test_setup_repo (GCancellable *cancellable,
   g_autoptr(GFile) repo_path = g_file_new_for_path ("repo");
   glnx_unref_object OstreeRepo* ret_repo = NULL;
 
-  if (!run_libtest ("setup_test_repository", error))
+  if (!run_libtest ("setup_test_repository archive-z2", error))
     goto out;
 
   ret_repo = ostree_repo_new (repo_path);